<template>
  <z-modal
    :width="800"
    v-bind="modalOption"
    :okText="false"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="disableSubmit">
      <a-form-model slot="detail" layout="horizontal" labelAlign="right" ref="ruleForm" :label-col="labelCol" :wrapper-col="wrapperCol" :model="form" :rules="validatorRules">
        <a-form-model-item label="项目名称" prop="name">
          <a-input placeholder="请输入项目名称" v-model.trim="form.name" />
        </a-form-model-item>
        <a-form-model-item label="项目编码" prop="num">
          <a-input placeholder="请输入项目编码" v-model.trim="form.num" />
        </a-form-model-item>
        <a-form-model-item label="单位" prop="unit">
          <a-input placeholder="请输入单位" v-model.trim="form.unit" />
        </a-form-model-item>
        <a-form-model-item label="价格" prop="price">
          <a-input-number :min="0" placeholder="请输入价格" v-model.trim="form.price" style="width: 100%" />
        </a-form-model-item>
        <a-form-model-item label="状态" prop="status">
          <z-dict-select-tag v-model="form.status" dictCode="product_status"/>
        </a-form-model-item>
        <a-form-model-item label="项目分类" prop="categoryId">
          <z-dict-select-tag placeholder="请输入项目分类" v-model="form.categoryId" dictCode="product_category" />
        </a-form-model-item>
        <a-form-model-item label="负责人" prop="ownerUserId">
          <ZSelectUserByDep :multi="false" v-model="form.ownerUserId" />
        </a-form-model-item>
        <a-form-model-item label="项目描述" prop="description">
          <a-textarea placeholder="请输入项目描述" v-model.trim="form.description" />
        </a-form-model-item>
      </a-form-model>
    </j-form-container>
    </a-spin>
  </z-modal>
</template>

<script>
import ModalFormMixin from '@/mixins/ModalFormMixin'
import ZDictSelectTag from '@/components/dict/ZDictSelectTag'
import JFormContainer from '@/components/form/JFormContainer'
import ZSelectUserByDep from '@/components/zzbiz/ZSelectUserByDep'

export default {
  name: "crmProductModal",
  mixins: [ModalFormMixin],
  components: {
    JFormContainer,
    ZDictSelectTag,
    ZSelectUserByDep
  },
  data() {
    return {
      validatorRules: {
        name: [
          { required: true, message: '请输入项目名称!' }
        ],
        num: [
          { required: true, message: '请输入项目编码!' }
        ],
      },
      url: {
        add: '/product/add',
        edit: '/product/edit'
      },
      // 查询参数
      queryParam: {},
      selectedRowKeys: [],
      selectedRows: [],
      toggleSearchStatus: false
    }
  },
  methods: {
    addAfter() {
    }
  }
}
</script>
